﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using System.Collections.ObjectModel;

namespace AlbumArtOrganizer.Plugins.FileSystem.AlbumScanner
{
    [Export(typeof(AlbumArtOrganizer.AlbumScanner.IAlbumScannerFactory))]
    public class AlbumScannerFactory : AlbumArtOrganizer.AlbumScanner.IAlbumScannerFactory
    {
        public const string OPTIONCONTRACTNAME = "AlbumScannerFileSystemOption";

        public string Name
        {
            get
            {
                return "File system";
            }
        }

        public AlbumArtOrganizer.AlbumScanner.IAlbumScanner CreateAlbumScanner(IEnumerable<AlbumArtOrganizer.Model.IOption> options)
        {
            var albumScanner = new AlbumScanner()
            {
                Options = options.ToList()
            };
            return albumScanner;
        }

        [ImportMany(OPTIONCONTRACTNAME, typeof(AlbumArtOrganizer.Model.IOption))]
        public ObservableCollection<AlbumArtOrganizer.Model.IOption> Options
        {
            get;
            set;
        }
    }
}
